<?php

namespace App\Models;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Laravel\Passport\HasApiTokens;

class User extends Authenticatable
{
//    use Notifiable;
    use HasApiTokens, Notifiable;

    protected $primaryKey = 'user_id';

    public $timestamps = false;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name' ,
        'mobile',
        'password',
        'paypwd',
        'head_pic',
        'level',
        'realname',
        'idcard_number',
        'is_lock',
        'is_truename_auth',
        'personal_rate',
        'last_ip',
        'last_login',
        'reg_time',
        'invited_code',
        'account_balance',
        'client_login',
        'api_version_number',
        'app_version_number',
        'mobile_brand',
        'mobile_model',
        'device_no',
        'mac_address',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'paypwd',
    ];

    public function findForPassport($username)
    {
        return $this->where('mobile', $username)->first();
    }

    public function infoAdd()
    {
        return $this->belongsTo(UserIdentityCheck::class, 'user_id', 'user_id');
    }


}
